﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input;

namespace Engine.Components
{
    public class InputManager:BaseManager
    {
        KeyboardState keyboardState;
        MouseState mouseState;
        GamePadState gamePadState;
        public KeyboardState KBState
        {
            get
            {
                return keyboardState;
            }
        }
        Client.BaseClient Client;
        Dictionary<Keys, Action> keys;
        public InputManager(NOWAEngine _game, ComponentManager manager, bool nodel = false)
            : base(_game, manager, nodel)
        {
            // TODO: Complete member initialization
            Client = new Client.BaseClient("192.168.35.212", 7777);
            

        }

        public Client.BaseClient GetNetClient
        {
            get
            {
                return Client;
            }
            set
            {
                Client = value;
            }
        }
        public KeyboardState KeyboardState
        {
            get { return keyboardState; }
        }
        public MouseState MouseState
        {
            get { return mouseState; }
        }
        public override void Initialize()
        {
            //Client.Start();
            base.Initialize();
        }
        public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            Client.Update(gameTime);
            keyboardState = Keyboard.GetState();
            mouseState = Mouse.GetState();
          
             base.Update(gameTime);
        }
        internal void SetPosition(int centerX, int centerY)
        {
            Mouse.SetPosition(centerX, centerY);
        }
        protected override void UnloadContent()
        {
            Client.ShutDown();
            base.UnloadContent();
        }
    }
}
